<%--
  Created by IntelliJ IDEA.
  User: 王仕鹏
  Date: 2024/11/18
  Time: 23:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="java.util.ArrayList" %>
<%@ page import="com.afishing.entity.User" %>
<%@ page import="com.afishing.listener.OnlineUserListener" %>
<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>Insert title here</title>
</head>

<body>
<span>当前在线人数：<%=this.getServletConfig().getServletContext().getAttribute("OnlineCount")%>></span>
<% response.setHeader("Refresh","2"); %>
<table width="80%" border="0" align="center">
  <tr bgcolor="orange" align="center">
    <td width="75%">消息</td>
    <td width="25%">当前在线</td>
  </tr>
  <tr bgcolor='pink'><td>
    <%
      ArrayList msgs=(ArrayList)application.getAttribute("msgs");
      for(int i=msgs.size()-1;i>=0;i--){
      out.println(msgs.get(i) + "<br>");
    }
    %>
  </td>
    <td valign='top' style="text-align: center;">
      <%
        ArrayList customers=(ArrayList)application.getAttribute("users");
        for(int i=customers.size()-1;i>=0;i--){
        User customer = (User) customers.get(i);
        out.println(customer.getUsername()+"<br>");
      }
      %>
    </td>
  </tr>
</table>
</body>

</html>
